home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-04 / gs24src.zip / MAKE.DOC < prev    next >
Text File  |  1992-03-25  |  19KB  |  458 lines

  1.    Copyright (C) 1989, 1990, 1991 Aladdin Enterprises.  All rights reserved.
  2.    Distributed by Free Software Foundation, Inc.
  3.  
  4. This file is part of Ghostscript.
  5.  
  6. Ghostscript is distributed in the hope that it will be useful, but
  7. WITHOUT ANY WARRANTY.  No author or distributor accepts responsibility
  8. to anyone for the consequences of using it or for whether it serves any
  9. particular purpose or works at all, unless he says so in writing.  Refer
  10. to the Ghostscript General Public License for full details.
  11.  
  12. Everyone is granted permission to copy, modify and redistribute
  13. Ghostscript, but only under the conditions described in the Ghostscript
  14. General Public License.  A copy of this license is supposed to have been
  15. given to you along with Ghostscript so you can know your rights and
  16. responsibilities.  It should be in a file named COPYING.  Among other
  17. things, the copyright notice and this notice must be preserved on all
  18. copies.
  19.  
  20. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  21.  
  22. This file, make.doc, describes how to install Ghostscript, and how to
  23. build Ghostscript executables from source.
  24.  
  25. For an overview of Ghostscript and a list of the documentation files, see
  26. README.
  27.  
  28. ********
  29. ******** Installing Ghostscript
  30. ********
  31.  
  32. To install the interpreter, you need:
  33.     - The interpreter executable:
  34.         - On MS-DOS and VMS systems, gs.exe.
  35.         - On MS-DOS systems, if you are using the Watcom compiler,
  36.           the DOS extender, dos4gw.exe.
  37.         - On Unix systems, gs.
  38.     - The interpreter initialization files: gconfig.ps,
  39.       gs_init.ps, gs_statd.ps, gs_fonts.ps, and sym__enc.ps.
  40.     - The font map: Fontmap.
  41.     - The default font: uglyr.gsf.
  42.  
  43. See use.doc for a description of the search algorithm used to find these
  44. files.
  45.  
  46. You do not need any of these files when using the library; however, the
  47. library currently provides no way to install fonts.  This is obviously
  48. ridiculous and will be fixed sometime in the future.
  49.  
  50. ********
  51. ******** Building Ghostscript from source
  52. ********
  53.  
  54. Ghostscript is generally distributed in the form of a compressed tar file.
  55. When unpacked, this file puts all the Ghostscript files in a directory
  56. called gs.  Ghostscript is also available in the form of PC-compatible ZIP
  57. files.
  58.  
  59. Ghostscript is described by a collection of several makefiles:
  60.  
  61.     gs.mak - a generic makefile used on all platforms (except VMS).
  62.     devs.mak - a makefile listing all the device drivers.
  63.     *.mak - the makefiles for specific platforms.
  64.  
  65. You may need to edit the platform-specific makefile if you wish to change
  66. any of the following options:
  67.  
  68.     - The default search path(s) for the initialization and font files
  69. (macro GS_LIB_DEFAULT);
  70.  
  71.     - The debugging options (macro TDEBUG);
  72.  
  73.     - The set of device drivers to be included (DEVICE_DEVS macro);
  74.  
  75.     - The set of optional features to be included (FEATURE_DEVS macro).
  76.  
  77. The platform-specific makefile will include comments describing all of
  78. these items except the DEVICE_DEVS options.  The DEVICE_DEVS options are
  79. described in devs.mak, even though the file that must be edited is the
  80. platform-specific makefile.
  81.  
  82. The makefiles distributed with Ghostscript define these options as
  83. follows:
  84.  
  85.     - GS_LIB_DEFAULT: on Unix systems, the current directory at build
  86. time; on MS-DOS systems, C:\GS.
  87.  
  88.     - TDEBUG: no debugging code included in the build.
  89.  
  90.     - DEVICE_DEVS: platform-specific, see below.
  91.  
  92.     - FEATURE_DEVS: platform-specific.
  93.  
  94. There are also platform-specific options described below under the
  95. individual platforms.  See the "Options" section near the beginning of the
  96. relevant makefile for more information.
  97.  
  98. If you are including a dot-matrix printer driver, you may wish to
  99. customize the default resolution parameters in devs.mak.
  100.  
  101. To build the interpreter, you need all the .h and .c files (and .asm files
  102. for MS-DOS) included in the distribution, as well as the makefiles.
  103.  
  104. The command
  105.     make clean
  106. removes all the files created by the build process (relocatables,
  107. executables, and miscellaneous scratch files).  If you want to save the
  108. executable, you should move it to another directory first.
  109.  
  110. ********
  111. ******** How to build Ghostscript from source (MS-DOS version) ********
  112. ********
  113.  
  114. The makefile distributed with Ghostscript selects the following devices
  115. for inclusion in the build:
  116.  
  117.     VGA, EGA, and VESA (SuperVGA) display drivers;
  118.     A BGI (Borland Graphics Interface) driver that handles
  119.       CGA and Hercules displays;
  120.     Epson-compatible 9-pin dot matrix printer at 120 x 60 DPI;
  121.     Epson-compatible 24-pin dot matrix printer at 180 x 180 DPI;
  122.     Canon BJ-10e;
  123.     H-P PaintJet, DeskJet, and LaserJet.
  124.  
  125. To build Ghostscript, you need MS-DOS version 3.3 or later, and a Borland
  126. C/C++ development system or the Watcom C/386 development system.  Details
  127. are given below.
  128.  
  129. As noted above, the default configuration generates an executable that
  130. assumes the directory where 'make' was run should be the final default
  131. directory for looking up the Ghostscript initialization and font files.
  132.  
  133. To build the Ghostscript executable, all you need to do is give the
  134. command
  135.     make
  136.  
  137. There is a special 'make' target that simply attempts to compile all the
  138. .c files in the current directory.  Some of these compilations will fail,
  139. but the ones that succeed will go considerably faster, because they don't
  140. individually pay the overhead of loading the compiler into memory.  So a
  141. good strategy for building the executable for the first time, or after a
  142. change to a very widely used .h file, is:
  143.     make begin
  144. and then
  145.     make
  146. to do the compilations that failed the first time.
  147.  
  148. Note: if you get the Ghostscript sources from a Unix 'tar' file and unpack
  149. the file on a MS-DOS machine, the files will all have linefeed instead of
  150. carriage return + linefeed as the line terminator, which will make the C
  151. compiler unhappy.  I don't know the simplest way to fix this: just reading
  152. each file into an editor and writing it back out again may be sufficient.
  153.  
  154. Borland environment
  155. -------------------
  156.  
  157. To compile Ghostscript with the Borland environment, you need either Turbo
  158. C (version 2.0 or later) or Turbo C++ or Borland C++ (version 1.0 or
  159. later); specifically, the compiler, 'make' utility, and linker.  You also
  160. need either the Borland assembler (version 1.0 or later) or the Microsoft
  161. assembler (version 4.0 or later).  Before compiling or linking, you should
  162. execute
  163.  
  164.     echo !include "turboc.mak" >makefile
  165. (for Turbo C), or
  166.     echo !include "tbcplus.mak" >makefile
  167. (for Turbo C++ or Borland C++).
  168.  
  169. Besides the source files and the makefiles, you need:
  170.     turboc.cfg (the flags and switches for Turbo C)
  171.     gt.tr (the linker commands for the library test program - optional)
  172.     gs.tr (the linker commands for the interpreter)
  173.     *.bat (a variety of batch files used in the build process)
  174.  
  175. There are extensive comments in the turboc.mak and tbcplus.mak files
  176. regarding various configuration parameters.  If your configuration is
  177. different from the following, you should definitely read those comments
  178. and see if you want or need to change any of the parameters:
  179.     - The compiler files are in c:\tc (for Turbo C) or c:\bc (for
  180. Turbo C++ or Borland C++) and its subdirectories.
  181.     - You are using the Borland assembler (tasm).
  182.     - You want an executable that will run on any PC-compatible,
  183. regardless of processor type (8088, 8086, V20, 80186, 80286, V30, 80386,
  184. 80486) and regardless of whether a math coprocessor (80x87) is present.
  185.  
  186. Watcom environment
  187. ------------------
  188.  
  189. To avoid annoying messages from the DOS extender, add the line
  190.     set DOS4G=quiet
  191. to your autoexec.bat file. 
  192.  
  193. To compile Ghostscript with the Watcom C/386 compiler, you need to create
  194. a makefile by executing
  195.  
  196.     echo !include watc.mak >makefile
  197.  
  198. To build Ghostscript, execute
  199.  
  200.     wmake -u
  201.  
  202. ********
  203. ******** How to build Ghostscript from source (Unix version) ********
  204. ********
  205.  
  206. The makefile distributed with Ghostscript selects the following devices
  207. for inclusion in the build:
  208.     X Windows driver only.
  209.  
  210. Before compiling or linking, you should execute
  211.  
  212.     ln -s unix-cc.mak makefile
  213. or    ln -s unix-gcc.mak makefile
  214. or    ln -s unix-ansi.mak makefile
  215.  
  216. depending on whether your C compiler is a standard Kernighan & Ritchie C
  217. compiler, gcc, or an ANSI C compiler other than gcc respectively.
  218.  
  219. If the X11 client header files are located in some directory which your
  220. compiler does not automatically search, you must change the XINCLUDE macro
  221. the makefile to include a specific -I switch.  See the comment preceding
  222. XINCLUDE in the makefile.
  223.  
  224. The only important customization of the X11 driver is the choice of
  225. whether or not to use a backing pixmap.  If you use a backing pixmap,
  226. Ghostscript windows will redisplay properly when they are covered and
  227. exposed, but drawing operations will go slower.  This choice is controlled
  228. by a line in the file gdevx.c that says
  229.     private int use_backing = 1;
  230. Changing this line to read
  231.     private int use_backing = 0;
  232. will disable the use of a backing pixmap.  However, portions of the
  233. Ghostscript window may not be properly redrawn after the window is
  234. restored from an icon or exposed after being occluded by another window.
  235.  
  236. Some versions of the X server do not implement tiling properly.  This will
  237. show up as broad bands of color where dither patterns should appear.  If
  238. this happens, change
  239.     private int use_XSetTile = 1;
  240. to
  241.     private int use_XSetTile = 0;
  242. and recompile.  The result will run a lot slower, but the output should be
  243. correct.  If this fixes the problem, report it to whoever made your X
  244. server.
  245.  
  246. Similarly, some versions of the X server do not implement bitmap/pixmap
  247. displaying properly.  This may show up as white or black rectangles where
  248. characters should appear.  If this happens, it may help you to change
  249.     private int use_XPutImage = 1;
  250. to
  251.     private int use_XPutImage = 0;
  252. and recompile.  Again, there will be a serious performance penalty; again,
  253. if this fixes the problem, notify the supplier of your X server.
  254.  
  255. Currently Ghostscript is set up to compile and link in a generic Unix
  256. environment.  Some Unix environments may require changing the LDFLAGS
  257. macro in the makefile.
  258.  
  259. All you need to do to make an executable is invoke the shell command
  260.     make
  261.  
  262. Ghostscript uses ANSI syntax for function definitions. Because of this,
  263. when compiling with cc, it must preprocess each .c file to convert it to
  264. the older syntax defined in Kernighan and Ritchie, which is what most
  265. current Unix compilers (other than gcc) support.  This step is
  266. automatically performed by a utility called ansi2knr, which is included in
  267. the Ghostscript distribution.  The makefile automatically builds ansi2knr.
  268.  
  269. The ansi2knr preprocessing step is included in the makefile rule for
  270. compiling .c files.  ansi2knr creates a file called _temp_.c to hold the
  271. converted code.  If you want to change this name for some reason, it is
  272. defined in unix-cc.mak.
  273.  
  274. Note that the abovementioned makefiles are actually generated mechanically
  275. from *head.mak, *tail.mak, gs.mak, and devs.mak.  If you want to change
  276. the makefile, edit the appropriate one of these files, and then invoke the
  277.     tar_cat
  278. shell script to reconstruct the unix-*.mak makefile.
  279.  
  280. Platform-specific notes
  281. -----------------------
  282.  
  283. There is apparently a bug in the MIPS C compiler which causes gxdither.c
  284. to compile incorrectly if optimization is enabled (-O).  Until a
  285. work-around is found, do not use -O with the MIPS C compiler.
  286.  
  287. On the Apollo, you must run the compiler in ANSI-compatible mode (i.e.,
  288. set AK= <null string> in the makefile); otherwise, it gives incorrect
  289. error messages for any function declared as returning a float value.
  290.  
  291. Due to a compiler bug, if you are building Ghostscript on an Intel 80386
  292. system using a version of gcc older than version 1.38, you must not use
  293. the -O option.
  294.  
  295. GNU make 3.59 can't handle the final linking step in some cases; use the
  296. platform's standard make (e.g., /bin/make) if this happens.
  297.  
  298. The Sun unbundled C compiler (SC1.0) doesn't compile Ghostscript properly
  299. if the -fast option is selected: Ghostscript core-dumps in build_gs_font.
  300. Use -g, or use gcc.
  301.  
  302. On the IBM RS/6000, you must define _POSIX_SOURCE and you must use the c89
  303. compiler, not cc, e.g.:
  304.  
  305.     make -f unix-ansi.mak CC=c89 XCFLAGS=-D_POSIX_SOURCE \
  306.     XINCLUDE=-I/usr/misc/X11/include XLIBDIRS=-L/usr/misc/X11/lib
  307.  
  308. Also, apparently some (but not all) releases of the C library declare the
  309. hypot function: if the declaration in math_.h produces an error message,
  310. try removing it.  Also, the IBM X11R3 server is known to be buggy: use the
  311. MIT X server if possible.  Even beyond all this, many people have trouble
  312. with Ghostscript on the RS/6000.  The usual symptom is that it compiles
  313. and links OK, but produces garbaged output on the screen.  The problem may
  314. be related to particular versions of AIX or the X server; we don't have
  315. enough information at this time.  The following combinations of AIX and X
  316. are known to fail:
  317.     AIX 3.1.5, MIT X11R4, c89
  318. The following combinations are known to work:
  319.     AIX 3.1.5, MIT X11R5, c89
  320.  
  321. For ISC Unix with gcc, an appropriate make invocation is:
  322.     make XCFLAGS="-D__SVR3 -posix" LDFLAGS="-shlib -posix" \
  323.          EXTRALIBS="-linet -lnsl_s"
  324. If this doesn't work for you, try removing the -shlib.
  325.  
  326. The SCO Unix C compiler apparently can't handle the Pn macros in std.h.
  327. If you get strange compilation errors on SCO Unix, see if you can get a
  328. compiler fix from SCO.  Meanwhile, to use gcc with SCO ODT, see
  329. gcc-head.mak for the appropriate switch settings.
  330.  
  331. Many versions of DEC's X server (DECwindows) have bugs that require
  332. setting use_XPutImage or use_XSetTile to 0, as described above.
  333.  
  334. ********
  335. ******** How to build Ghostscript from source (VAX/VMS version) ********
  336. ********
  337.  
  338. The files VMS-CC.MAK and VMS-GCC.MAK are VMS DCL command files which
  339. build Ghostscript from scratch using either the DEC C compiler, CC, or
  340. the Free Software Foundation's GNU C compiler, GCC.  Accordingly, you
  341. must have one of these two compilers installed in order to build
  342. Ghostscript.  (Other C compilers may work: CC and GCC are the only two
  343. compilers tested to date.)  These two command files build and store
  344. the Ghostscript library in the object library GS.OLB.  If you have
  345. DECwindows (X11) installed on your system, the executable images GS.EXE,
  346. GT.EXE, and XLIB.EXE will also be built.
  347.  
  348. The only important customization of the X11 driver is the choice of
  349. whether or not to use a backing pixmap.  If you use a backing pixmap,
  350. Ghostscript windows will redisplay properly when they are covered and
  351. exposed, but drawing operations will go slower.  This choice is controlled
  352. by the line in the file gdevx.c that reads
  353.     private int use_backing = 1;
  354. Changing this line to read
  355.     private int use_backing = 0;
  356. will disable the use of a backing pixmap.  However, portions of the
  357. Ghostscript window may not be properly redrawn after the window is
  358. restored from an icon or exposed after being occluded by another window.
  359.  
  360. Many versions of DEC's X server (DECwindows) have bugs that require
  361. setting use_XPutImage or use_XSetTile to 0, as described above.  These
  362. show up as broad bands of color where dither patterns should appear, or
  363. characters displayed white on top of black rectangles or not displayed at
  364. all.  If this happens, change use_XSetTile or use_XPutImage to 0 as
  365. described above.  The result will run a lot slower, but the output will be
  366. correct.  Report the problem to DEC, or whoever supplied your X server.
  367.  
  368. Ghostscript uses ANSI syntax for function definitions. Thus, when using
  369. the DEC C compiler, each .C file is converted to the older C syntax defined
  370. in the first edition of Kernighan and Ritchie and stored in a .CC file.
  371. This step is performed by VMS-CC.MAK using the ansi2knr utility included
  372. in the Ghostscript distribution.  If you are building a debuggable
  373. configuration, the .CC files will be left behind by VMS-CC.MAK for use by
  374. the VMS Debugger; otherwise, they will be deleted.
  375.  
  376. If you have DEC's C compiler, issue the DCL command
  377.         $ @VMS-CC.MAK
  378. to build Ghostscript.  If you have GNU C, issue the DCL command
  379.         $ @VMS-GCC.MAK
  380. to build Ghostscript.
  381.  
  382. The option "DEBUG" may be specified with either command file in order to
  383. build a debuggable Ghostscript configuration:
  384.         $ @VMS-CC.MAK DEBUG    -or-   $ @VMS-GCC.MAK DEBUG
  385.  
  386. In order to specify switches and file names when invoking the interpreter,
  387. define GS as a foreign command:
  388.         $ GS == "$disk:[directory]GS.EXE"
  389. where "disk" and "directory" specify the disk and directory where Ghostscript
  390. is located.  For instance,
  391.         $ GS == "$DUA1:[GHOSTSCRIPT]GS.EXE"
  392. To allow the interpreter to be run from any directory, define the logical
  393. GS_LIB which points to the Ghostscript directory
  394.         $ DEFINE GS_LIB disk:[directory]
  395. This allows Ghostscript to locate its initialization files stored in the
  396. Ghostscript directory -- see use.doc for further details.  Finally, to
  397. invoke the interpreter, merely type GS.  Although DCL normally converts
  398. unquoted parameters to upper case, C programs receive their parameters in
  399. lower case.  That is, the command
  400.         $ GS -Isys$login:
  401. passes the switch "-isys$login" to the interpreter.  To preserve the
  402. case of switches, enclose them in double quotes; e.g.,
  403.         $ GS "-Isys$login:"
  404.  
  405. ********
  406. ******** A guide to the files ********
  407. ********
  408.  
  409. General
  410. -------
  411.  
  412. There are very few machine dependencies in Ghostscript.  A few of the .c
  413. files are machine-specific.  These have names of the form
  414.     gp_<platform>.c
  415. specifically
  416.     gp_dos.c
  417.     gp_unix.c
  418.     gp_vms.c
  419. There are also some machine-specific conditionals in files with names
  420. <something>_.h, and in gdevmem.c.  If you are going to extend Ghostscript
  421. to new machines or operating systems, you should check all the source
  422. files (both .c and .h) for ifdef's on things other than DEBUG, and you
  423. should probably count on making a new makefile and a new gp_ file.
  424.  
  425. Library
  426. -------
  427.  
  428. gt.c is a test driver for the library.
  429.  
  430. Files beginning with gs, gx, or gz (both .c and .h), other than gs.c, are
  431. the Ghostscript library.  Files beginning with gdev are device drivers or
  432. related code, also part of the library.  Other files beginning with g are
  433. library files that don't fall neatly into either the kernel or the driver
  434. category.
  435.  
  436. Interpreter
  437. -----------
  438.  
  439. gs.c is the main program for the language interpreter.
  440.  
  441. Files beginning with z are Ghostscript operator files.  The names of the
  442. files generally follow the section headings of the operator summary in
  443. section 6.2 of the PostScript manual.
  444.  
  445. .c files beginning with i, and .h files not beginning with g, are the
  446. rest of the interpreter.  See the makefile for a little more information
  447. on how the files are divided functionally.
  448.  
  449. There are a few files that are logically part of the interpreter, but that
  450. are potentially useful outside Ghostscript, whose names don't begin with
  451. either g, z, or i:
  452.  
  453.     s*.c (a flexible stream package, including the Level 2 PostScript
  454. 'filters' supported by Ghostscript);
  455.  
  456.     trace.c (a procedure tracing package for debugging) and utrace.c
  457. (the Unix stub for trace.c).
  458.